package transcation;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.orm.jpa.JpaTransactionManager;


import java.sql.SQLException;

public class TranscationManagerBean {


    public static void main(String[] args) throws SQLException {

        ApplicationContext context = new ClassPathXmlApplicationContext("classpath:transcation.xml");
//        dataSourceTranscationManager
        DataSourceTransactionManager manager = context.getBean("transcationManager", DataSourceTransactionManager.class);
        System.out.println(manager.getDataSource().getConnection().toString());


        JpaTransactionManager jpaTransactionManager = context.getBean("jpaTransactionManager", JpaTransactionManager.class);
        System.out.println(jpaTransactionManager.getDataSource());


    }

}
